<template>
    <div class="add-product">
      <div class="header">
        <h2>请输入添加产品的基本信息</h2>
        <button class="back-btn" @click="goBack">点击返回</button>
      </div>
  
      <form action="#" class="form-group">
        <label for="deviceName">设备名称:</label>
        <input type="text" id="deviceName" v-model="productName" placeholder="请输入设备名称">
  
        <label for="deviceUnit">设备单位:</label>
        <input type="text" id="deviceUnit" v-model="productUnit" placeholder="请输入设备单位">
  
        <button type="submit" class="submit-btn" @click.prevent="submitForm">添加</button>
      </form>
    </div>
  </template>
  
  <script>
  export default {
    name: 'AddProduct',
    data() {
      return {
        productName: '',
        productUnit: ''
      };
    },
    methods: {
      goBack() {
        // 返回上一级页面逻辑
      },
      submitForm() {
        // 提交表单逻辑
      }
    }
  };
  </script>
  
  <style scoped>
  .add-product {
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 500px;
    margin: 50px auto;
  }
  
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .back-btn {
    background-color: transparent;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 16px;
  }
  
  .back-btn:hover {
    text-decoration: underline;
  }
  
  .form-group {
    margin-bottom: 15px;
  }
  
  label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
  }
  
  input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
  }
  
  .submit-btn {
    width: 100%;
    padding: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
  }
  
  .submit-btn:hover {
    background-color: #0056b3;
  }
  </style>
  